package Test11_08;

import java.util.ArrayList;
import java.util.*;
import java.util.Scanner;

public class Company implements Comparable<People>{
    //公司有公司名称，注册地址，电话，经营范围等属性
    private String comName = "合肥科海";
    private String comAddres = "包河区";
    private String comTel = "13965335332";
    private String comBusiness = "房产中介";//经营范围
    int pos = 0;
    List<People> list = new ArrayList<>();



    @Override
    public String toString() {
        return "Company{" +
                "公司名称='" + comName + '\'' +
                ", 公司地址='" + comAddres + '\'' +
                ", 公司电话='" + comTel + '\'' +
                ", 经营范围='" + comBusiness + '\'' +
                '}';
    }

    //公司有招聘员工（要求工号不能重复），有输出员工信息，以及辞退员工，和统计公司人数,获得公司薪水最高的员工的方法
    //添加员工
    // private String name;
//    private String age;
//    private String sex;
//    private String work;
//    private String money;
//    private int id;
    public void addPeo(String name, int age, String sex, String work, int money, String id) {
        if (pos >= list.size()) {
            System.out.println("人满了");
        }
        for (int i = 0 ;i<list.size();i++){
            if (list.get(i).getId() == (id)){
                System.out.println("工号重复，添加失败");
                return;
            }
        }
        list.add(new People(name,age,sex,work,money,id));
        System.out.println("添加成功");
        pos++;
    }

    //查看总人口
    public void comPosShow() {
        System.out.println(pos);
    }

    //输出员工
    public void show() {
        for (int i = 0 ;i<list.size();i++){
            System.out.println(list.get(i));
        }
    }

    //辞职
    public void fired(String id) {
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getId().equals(id)) {
                list.remove(i);
                System.out.println("删除OK");
                return;
            } else {
                System.out.println("没冲过,请查看id是否输入有误");
            }
        }
    }

    //薪水
    public void maxSee()  {
        People people = list.get(0);
        for (int i = 0;i < list.size();i++){
            if (list.get(i).getMoney() > people.getMoney()){
                people=list.get(i);
            }
        }
        System.out.println(people);

    }
    public void maxAge(){
        People people = list.get(0);
        int i = 0;
        for (;i < list.size();i++){
            if (list.get(i).getAge() > people.getAge()){
                people=list.get(i);
            }
        }
    }


    @Override
    public int compareTo(People people) {

        return 0;
    }
}

